home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
9-Digit Zip Code Directory
/
9-Digit Zip Code Directory (American Business Information) (ABIZIP-12).ISO
/
z4src.zip
/
BS.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-09-02
|
5KB
|
231 lines
//----------------------------------------------------------------------------
// MODULE DESCRIPTION
//
// Module: base.c
// Title: Base library
// Notice: John M. Weeder
// Copyright (c) 1993. All rights reserved.
// This module contains proprietary information and should be
// treated as confidential.
//
//----------------------------------------------------------------------------
// MAINTENANCE HISTORY
//
// $Workfile$
// $Revision$
// $Author$
// $Date$
// $Log$
//
//----------------------------------------------------------------------------
// MODULE NARRATIVE
//
//
// This module contains code to test the base library.
//
// The code in this module should be written entirely in C.
// Do not use any C++ constructs.
//
// This module is portable to:
// DOS 3.X+
// MS Windows 3.X+
// OS/2 2.X+
// OS/2 2.0 PM
// SCO UNIX.
//
// The following compilers are supported:
// MSC 6.0A
// MSC/C++ 7.0
// Borland C++ 3.1 for DOS
// Borland C++ 1.0 for OS/2 2.X
// SCO UNIX cc
//
//----------------------------------------------------------------------------
#include <bs.h>
//----------------------------------------------------------------------------
// Stack size
//----------------------------------------------------------------------------
#if COMPILER_BORLAND && (OS_DOS || OS_WINDOWS)
unsigned _stklen = 0x4000;
#endif
typedef BOOL (FN *PFNTEST)(SHORT);
//----------------------------------------------------------------------------
// Description: main() - Program entry point
// Parameters: Standard C parameters
// Returns: DOS return code.
//----------------------------------------------------------------------------
int main(int argc, char **argv)
{
static PSZ apszTest[] =
{
"ASSERT",
"BCD",
"BOOT",
"COMMANDLINE",
"COPY",
"CPU",
"CRC",
"CRITERR",
"DEBUG",
"DISPLAY",
"DRIVE",
"EBCDIC",
"ENV",
"ERROR",
"FILE",
"FINFO",
"FNAME",
"GARBLE",
"HALT",
"HEAP",
"IO",
"KBD",
"LEV",
"LOG",
"MEM",
"META",
"MSCDEX",
"NOVELL",
"PARENT",
"PASSWORD",
"PID",
"PIPE",
"PRINT",
"PRINTSCREEN",
"PROGSIZE",
"QUERY",
"RANDOM",
"REV",
"SERIAL",
"SLEEP",
"SOUND",
"STRING",
"TEXTIN",
"TEXTOUT",
"THREAD",
"TOKEN",
"UMB",
"VERSION",
"VOLLBL",
"WRAP",
NULL
};
static PFNTEST apfntest[] =
{
AssertTest,
BcdTest,
BootTest,
CommandLineTest,
CopyTest,
CpuTest,
CrcTest,
CritErrTest,
DebugTest,
DisplayTest,
DriveTest,
EbcdicTest,
EnvTest,
ErrorTest,
FileTest,
FinfoTest,
FnameTest,
GarbleTest,
HaltTest,
HeapTest,
IOTest,
KbdTest,
LevTest,
LogTest,
MemTest,
MetaTest,
MscdexTest,
NovellTest,
ParentTest,
PasswordTest,
PidTest,
PipeTest,
PrintTest,
PrintScreenTest,
ProgSizeTest,
QueryTest,
RandomTest,
RevisionTest,
SerialTest,
SleepTest,
SoundTest,
StringTest,
TextInTest,
TextOutTest,
ThreadTest,
FileTokenTest,
UmbTest,
VersionTest,
VolLblTest,
WrapTest,
};
static BOOL fHelp = FALSE;
static LONG lTest = 0;
static CHAR szTest[80];
static BS_CMDOPT acmdopt[] =
{
{ "TEST", (PVOID)&lTest, CMDOPT_NUMERIC, "Test number\nLine 2"},
{ "test_name", (PVOID)szTest, _CMDOPT_FILESPEC|CMDOPT_REQUIRED|80, "Name of test"},
BS_CMDOPT_NULL
};
static BS_CFG cfg = CFG_DFT;
BOOL fFound = FALSE;
BOOL fResult;
SIZET i;
BaseLibraryInitialize(argc, argv, &cfg);
BaseTitle("$Revision: 93.1 $", __DATE__, __TIME__, "Base Library Test Program");
if (BaseTitleHelp(acmdopt, "Base library test program description", 0))
{
for (i = 0; apszTest[i]; ++i)
{
if (stricmp(szTest, apszTest[i]) == 0)
{
fFound = TRUE;
if (lTest)
printf("\n%s Test #%ld:\n\n", apszTest[i], lTest);
else
printf("\n%s Test.\n\n", apszTest[i]);
fResult = (*apfntest[i])((SHORT)lTest);
break;
}
}
if (fFound)
{
if (!fResult)
{
printf("\nTest failed!\n");
return 2;
}
else
{
printf("\nTest succeeded!\n");
}
}
}
if (!fFound || fHelp)
{
printf("Select one of the following options:\n");
for (i = 0; apszTest[i]; ++i)
printf(" %s\n", apszTest[i]);
return 1;
}
return 0;
}
//----------------------------------------------------------------------------
//------------------------------- End of File --------------------------------
//----------------------------------------------------------------------------